//导入各种包
const cors = require('cors');
const expressJWT = require('express-jwt');
const express = require('express')
const app = express()


// 允许所有来源的跨域请求
app.use(cors());


// 配置解析表单
app.use(express.urlencoded({ extended: false }));
app.use(express.json({ limit: '105mb' }));


// // //跨域设置
// app.use(cors({
//   origin: '*',
//   methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
//   allowedHeaders: 'Content-Type,Authorization',
// }));



// const jwtconfig = require('./initconfig/jwtconfig')


// // 配置解析token的中间建
// app.use(expressJWT({
//   secret: jwtconfig.jwtSecretKey,
//   algorithms: ['HS256'],
// }).unless({ path: [/^\/api/] }));

// //配置token验证中间件
// const { verifyToken } = require('./middleware/authMiddleware')
// app.use(verifyToken)


//导入路由并使用题库路由
const router1 = require('./router/T_question')
const router2 = require('./router/T_subject')
const router3 = require('./router/T_label')
const router4 = require('./router/T_paper')
const router5 = require('./router/T_user')
const router6 = require('./router/t_exam_target')
app.use(router1)
app.use(router2)
app.use(router3)
app.use(router4)
app.use(router5)
app.use(router6)

const router7 = require('./router/t_paper_info')
const router8 = require('./router/t_exam_target _to_question')
const router12 = require('./router/T_exam_target_to_question2')
const router13 = require('./router/T_login')//登录注册
const route14 = require('./router/T_own')//个人页
// const router17 = require('./router/openAI')
app.use(router7)
app.use(router8)
app.use(router12)
app.use(router13)
app.use(route14)
// app.use(router17)

//课程大纲相关的接口，由于太多，为合并方便，我直接从100开始
const route100 = require('./router/Course outline/Class_description'); //描述表（第二个）
app.use(route100)
const route101 = require('./router/Course outline/b_eginning'); //开头表（最上面的）
app.use(route101)
const router102 = require('./router/Course outline/class_Introduce');//一、课程介绍
app.use(router102)
const router103 = require('./router/Course outline/class_Target');//二、课程内容课程内容课程目标
app.use(router103)
const router104 = require('./router/Course outline/index_Point')//三、课程目标与毕业要求指标点的对应关系
app.use(router104)
const router105 = require('./router/Course outline/class_Content')//四、课程内容
app.use(router105)
const router106 = require('./router/Course outline/course_schedule')//五、课程教学进度安排
app.use(router106)
const router107 = require('./router/Course outline/class_Teaching_methods')//六、课程教学方法
app.use(router107)
const router108 = require('./router/Course outline/class_Assessment_method')//七、课程考核方式
app.use(router108)
const router109 = require('./router/Course outline/weight_Support_link')//八、课程考核成绩评定方法
app.use(router109)
const router110 = require('./router/Course outline/evaluation_mechanism')//九、课程目标达成度评价
app.use(router110)
const router111 = require('./router/Course outline/class_Target_Weight')//十、本课程各个课程目标的权重
app.use(router111)
const router112 = require('./router/Course outline/continuous_Improvement')//十一、持续改进
app.use(router112)
const router113 = require('./router/Course outline/b_ook')//十二、教材和参考书目
app.use(router113)

const router9 = require('./router/T_quick_fill')
app.use(router9)

//自动
const router10 = require('./router/t_auto_produce_paper')
app.use(router10)

//题型获取
const router11 = require('./router/T_question_type')
app.use(router11)

//达成度
const router15 = require('./router/T_course_achivement')
app.use(router15)


//题目分值
const router16 = require('./router/T_question_score')
app.use(router16)

app.listen(8081, () => {
  console.log('响应成功')
})